﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SPIWareMVVM.ViewModels;
using System.Windows.Controls;
using System.Windows;
using SPIWareMVVM.Reports;

namespace SPIWareMVVM.Views.Commands
{
    public class PrintReportsCommand : BaseCommand
    {
        public PrintReportsCommand(BaseViewModel sender) : base(sender) { }

        public override void Execute(object parameter)
        {
            ApplicationViewModel appVM = (ApplicationViewModel)base._sender;
            if (mainWindow == null) mainWindow = (Window1)parameter;

            if (appVM != null)
            {
                PrintDialog pd = new PrintDialog();

                if (appVM.SelectedCustomer != null) { }
                //else if (appVM.SelectedMaterial != null) { }
                else if (appVM.SelectedPressMachine != null) { }
                else if (appVM.SelectedUser != null) { }
                else if (appVM.SelectedWorkOrder != null)
                {
                    mainWindow.workOrdersList.dpWorkOrderEdit.Visibility = Visibility.Collapsed;
                    mainWindow.workOrderReport.dataView.DataContext = appVM.SelectedWorkOrder;
                    mainWindow.workOrderReport.Visibility = Visibility.Visible;
                }
            }
        }
    }
}
